Skip to content

fix: extract_module missing import for macro calls#22437

Merged
Veykril merged 1 commit into
rust-lang:masterfrom
Albab-Hasan:extract-module-macro-import
May 25, 2026
Merged

fix: extract_module missing import for macro calls#22437
Veykril merged 1 commit into
rust-lang:masterfrom
Albab-Hasan:extract-module-macro-import

Conversation

@Albab-Hasan
Copy link
Copy Markdown
Contributor

check_def_in_mod_and_out_sel had arms for every item kind (Function, Adt, Const, etc.) but no arm for Definition::Macro. it fell through to _ => {} and returned (false, false), making def_out_sel always false for macros. in downstream the condition (def_out_sel || !is_item) && use_stmt_not_in_sel was never satisfied so no import was added to the extracted module.

add Definition::Macro(x) => check_item!(x), to the match so the macros source location is checked the same way as other items.

closes #20209

  Fixes rust-lang#20209

   was missing a  arm,
  causing it to always return  for macros. This made
   false, so the import was never added to the extracted
  module.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 24, 2026
Copy link
Copy Markdown
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Veykril Veykril added this pull request to the merge queue May 25, 2026
Merged via the queue into rust-lang:master with commit 5c33ca4 May 25, 2026
18 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract module assist fails to add import for function-like macro

3 participants